include make.ofiles
include make.dep

CXX = gcc

ifeq ($(optimized), yes)
  CXX += -O3
else
  debug_ext = .g
  CXX += -g	
endif

bin = /home/xlhu/bin/linear_response  
library = lib/libNanoOptic$(debug_ext).so

AR = ar
RANLIB=ranlib

CXXFLAGS = -fPIC -std=c99 -w -Iinclude -I/home/xlhu/include
CXXLIBS = -lgfortran -lfftw3 -llapack -lblas -lm -Llib -L/home/xlhu/lib -L/usr/lib

default: $(bin)

$(bin): $(library)
	$(CXX) linear_response.c -o $@ $(CXXLIBS) -lNanoOptics$(debug_ext)

$(library): $(OBJECTS)
	$(CXX) -shared -o $@ $(OBJECTS) $(CXXLIBS)

static: $(OBJECTS)
	$(AR) rl $@ $^
	$(RANLIB) $@ 

obj/%.o: src/%.c
	$(CXX) -w -c -o $@ $< $(CXXFLAGS)

.PHONY: default all 
